package com.jy.modules.cims.component.image.task;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.jy.modules.cims.common.sysUtils.SpringContextUtils;
import com.jy.modules.cims.component.image.TransferImagesQueue;
import com.jy.modules.cims.component.image.service.AddWaitDealQueueService;

/**
 * @description AddWaitDealQueueTask
 * @author shengzhoutao
 * @date 2015-09-29
 */
@Component
public class AddWaitDealQueueTask extends AbstractTransferImagesTask {

	@Autowired
	private SpringContextUtils springContextUtils;

	@Override
	public void doSomething() {

		if (TransferImagesQueue.downQueue.isEmpty()) {
			int count = springContextUtils.getBean(AddWaitDealQueueService.class).add();
			if (count == 0) {
				this.sleep(1000 * 60 * 3);
			} else {
				this.notifyQuery();
				this.sleep(1000 * 20);
			}
		} else {
			this.sleep(1000 * 10);
			return;
		}
	}
	
}
